#pragma once
#include <nice2d/component.h>
#include <nice2d/piece/faction.h>

class FactionManager : public Component
{
public:
    FactionManager();
    ~FactionManager();
public:
    FactionPointer createFaction(const sf::Color &color,const std::wstring &name,const std::wstring &desc = std::wstring());
    FactionPointer getFaction(const sf::Color &color);

    void switchFaction();
    boost::signals2::signal<void()> newRound;

    FactionPointer getCurrentFaction();

    void update(float deltaTime)override;
public:
    PTree serialize()override;
    void deserialize(const PTree &node)override;
private:
    std::unique_ptr<class FactionManagerData> data;
};
